<!--textarea name="reply-content" id="reply-textarea" rows="10" placeholder="Type it..."></textarea-->
<!--reply panel-->
<include file="../Public/header" />
<div id="content" class="content">
    <div id="reply-weiba" data-title="回复帖子" data-selected="true" data-footer="none" data-rememberScroll="true">
    <header>
        <div id="header-buttons">
            <div class="header-menu-link" id="hmp-cancel">
                <a class="ts-listen" data-listen="weibo-goback-true">取消</a>
            </div>
            <div class="header-menu-link" id="hmp-send">
                <a id="ts-reply-submit" class="sendBtn disable fc4">发送</a>
            </div>
        </div>
        <h1 style="text-align:center;">
            回复帖子
        </h1>
    </header>
    <div class="pure-form send_box">
        <textarea name="reply-content" id="reply-textarea" class="ts-textarea ts-listen" rows="4" placeholder="说点什么呢......" data-listen="weibo-checknums-true" tabindex="0"><php>echo $reply?'回复@'.getUserName($reply['uid']).' ：':'';</php></textarea>
        <div model-node="numsLeft" class="num">{$initNums}</div>
        <div class="ckb">
            <label id="toShare"><input type="checkbox" class="checkbox" id="ifShareFeed_reply" name="ifShareFeed" value="1">{:L('PUBLIC_SHARETO_STREAM')}</label>
        </div>
    </div>
    <div class="ts-footer">
        <a class="icon facelistbutton ts-listen" data-listen="weibo-facelist-show"><i class="fa-btn fa-btn-smile"></i></a>
        <a class="icon imgbutton ts-listen" data-listen="weibo-upload-img" data-for="ts-upload-img-box" id="new-weibo-upload"><i class="fa-btn fa-btn-picture"></i></a>
    </div>
    <div id="ts-upload-img-box"></div>
</div>
    <script type="text/javascript">
        $(function(){
            TS.app.weibo.listen.checknums(true, $('#reply-textarea'), '', true);
            var url = "{:U('widget/WeibaReply/addReply')}";
            var data = {};
            data.widget_appname = 'weiba';
            data.weiba_id = '<php>echo $post["weiba_id"];</php>';
            data.post_id = '<php>echo $post["post_id"];</php>';
            data.post_uid = '<php>echo $post["post_uid"];</php>';
            data.to_reply_id = '<php>echo $reply?$reply["reply_id"]:0;</php>';
            data.to_uid = '<php>echo $reply?$reply["uid"]:0;</php>';
            data.feed_id = '<php>echo $post["feed_id"];</php>';
            data.content = '';
            data.ifShareFeed = '0';
            data.attach_id = '0';
            data.list_count= '<php>echo $list_count;</php>';
            $('#hmp-send').click(function(){
                var content = $.trim($('#reply-textarea').val());
                if(!content){
                    $.ui.showMask("请输入内容！", true);
                    return false;
                }
                data.content = content;
                if($('#ifShareFeed_reply:checked').size() > 0){
                    data.ifShareFeed = '1';
                }
                if($('#ts-upload-img-box .file_list_view').size()>0){
                    data.attach_id = $('#ts-upload-img-box .file_list_view:first').data('id');
                }
                $.post("{:U('widget/WeibaReply/addReply')}", data, function(result){
                    if(result.status == 1){
                        $.ui.showMask("回复成功！", true);
                        setTimeout(function(){
                            window.location.href = "{:U('postDetail', array('post_id'=>$post['post_id']))}";
                        }, 1200);
                    }else{
                        $.ui.showMask("回复失败，请稍候再试！", true);
                    }
                }, 'json');
            });
        })
    </script>
<include file="../Public/footer" />